<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
</head>
<body>
<div>
    <div id="t" data-x='y'>

    </div>
</div>
<script>
    var t = document.getElementById('t');
    t.dataX = 'z';
    t = t.cloneNode(true);
    document.body.appendChild(t);
    alert(t.dataX);
</script>
</body>
</html>